import java.awt.Color;
import java.awt.Graphics;

/*
 * Created on Mar 8, 2005
 */

/**
 * @author Jesse Phillips
 */
public class DrawMe {
    private Graphics g;
    private Color bgColor, currentColor;
    private int score = 0, preScore, highScore = 0, ballNum = 0;
    
    public DrawMe(Graphics myG) {
        g = myG;
    }
    
    public void setColor(Color c) {
    	g.setColor(c);
    }
    
    public void setBGColor(Color c) {
    	bgColor = c;
    }
    
    public void oval(int x, int y, int w, int h, Color c, boolean fill) {
		 // You need to draw an oval here.
		/*ans bl*/
    	g.setColor(c);
    	if(fill) {
    		g.fillOval(x, y, w, h);
    	}else {
    		g.drawOval(x, y, w, h);
    	}
		/*ans ab*/
    }
    
    public void removeOval(int x, int y, int w, int h) {
    	currentColor = g.getColor();
    	g.setColor(bgColor);
    	g.fillOval(x, y, w, h);
    	g.setColor(currentColor);
    }
    
    public void rect(int x, int y, int w, int h, Color c, boolean fill) {
    	g.setColor(c);
    	if(fill) {
    		g.fillRect(x, y, w, h);
    	}else {
    		g.drawRect(x, y, w, h);
    	}
    }
    
    public void circle(int x, int y, int r, Color c, boolean fill) {
    	int startX, startY;
    	g.setColor(c);
    	startX = (x - r);
    	startY = (y - r);
    	g.fillOval(startX, startY, (2*r), (2*r));
    }
    
    public void removeCircle(int x, int y, int r) {
    	int startX, startY;
    	
    	currentColor = g.getColor();
    	g.setColor(bgColor);
    	startX = (x - r);
    	startY = (y - r);
    	g.fillOval(startX, startY, (2*r), (2*r));
    	g.setColor(currentColor);
    }
    
	public void player(int x) {
		g.setColor(Color.black);
		g.drawLine(x, 380, x-5, 400);
		g.drawLine(x, 380, x+5, 400);
	}
	
	public void removePlayer(int x) {
		g.setColor(Color.white);
		g.drawLine(x, 380, x-5, 400);
		g.drawLine(x, 380, x+5, 400);
	}

	public void score() {
		g.setColor(Color.white);
		g.drawString("Your Score is: "+preScore, 10, 60);
		g.setColor(Color.black);
		g.drawString("High Score: "+highScore, 10, 45);
		g.drawString("Your Score is: "+score, 10, 60);
	}
	
	public void string(String s, Color c) {
		g.setColor(c);
		g.drawString(s, 200, 200);
	}
	

	public void scoreAdd(int t) {
		preScore = score;
		if(t == 0) score += 100;
		else score += 100/t;
	}
	
	public void gameOver() {
		if(score > highScore) {
			g.setColor(Color.white);
			g.drawString("High Score: "+highScore, 10, 45);
			highScore = score;
		}
		reset();
	}
	
	public void addBall() {
		ballNum++;
	}
	
	public void reset() {
		score = 0;
		ballNum = 0;
	}
	
	public int getBallNum() {
		return ballNum;
	}
}
